package com.ktgj.service.api.factory;

import com.ktgj.common.core.domain.R;
import com.ktgj.service.api.RemoteService;
import com.ktgj.service.api.domain.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;

import java.util.List;
import java.util.Map;


/**
 * @author wyj
 * @create 2021-10-18 13:48
 */
@Component
public class RemoteServiceFallbackFactory implements FallbackFactory<RemoteService> {

    private static final Logger log = LoggerFactory.getLogger(RemoteServiceFallbackFactory.class);

    @Override
    public RemoteService create(Throwable cause) {
        log.error("远程获取权益服务范围列表失败:{}", cause.getMessage());
        return new RemoteService() {
            @Override
            public List<AirportServiceApi> getAirportServiceList() {
                log.error("获取机场服务列表失败:{}",cause.getMessage());
                return null;
            }

            @Override
            public List<VipboardingApi> getVipboardingList() {
                log.error("获取值机服务列表失败:{}",cause.getMessage());
                return null;
            }

            @Override
            public List<VipchannelApi> getVipchannelList() {
                log.error("获取VIP通道列表失败:{}",cause.getMessage());
                return null;
            }

            @Override
            public List<ViphallApi> getViphallList() {
                log.error("获取贵宾厅列表失败:{}",cause.getMessage());
                return null;
            }

            @Override
            public Map<String, Object> queryViphallTrip(Long orderviphallId) {
                log.error("获取贵宾厅行程失败:{}",cause.getMessage());
                return null;
            }

            @Override
            public Map<String, Object> selectItineraryHall(Long orderviphallId) {
                log.error("获取贵宾厅信息失败！", cause.getMessage());
                return null;
            }

            @Override
            public Map<String, Object> queryVipchannelTrip(Long ordervipchannelId) {
                log.error("获取VIP通道行程失败:{}",cause.getMessage());
                return null;
            }

            @Override
            public Map<String, Object> selectItineraryChannel(Long ordervipchannelId) {
                log.error("获取VIP通道信息失败！", cause.getMessage());
                return null;
            }

            @Override
            public boolean selectVipHallVoByAirportCode(String airportCode) {
                log.error("获取机场三字码失败:{}",cause.getMessage());
                return false;
            }

            @Override
            public boolean selectVipchannelByAirportCode(String airportCode) {
                log.error("获取机场三字码失败:{}",cause.getMessage());
                return false;
            }

            @Override
            public R<OrderViphallApi> queryItineraryHall(Long customerId) {
                return R.fail("获取贵宾厅订单失败！" + cause.getMessage());
            }

            @Override
            public R<OrderVipchannelApi> queryItineraryChannel(Long customerId) {
                return R.fail("获取VIP通道订单失败！" + cause.getMessage());
            }

            @Override
            public R<VipHallVipChannelPriceApi> selectVipHallPrice(Long id) {
                return R.fail("获取贵宾厅价格失败！" + cause.getMessage());
            }

            @Override
            public R<VipHallVipChannelPriceApi> selectVipChannelPrice(Long id) {
                return R.fail("获取VIP通道价格失败！" + cause.getMessage());
            }

            @Override
            public BoardingPassVoApi orderBoardingNum(Map<String, Object> map) {
                log.error("获取代理等级牌订单量失败:{}",cause.getMessage());
                return null;
            }

            @Override
            public List<OrderViphallVoApi> orderViphallByCustomer(Map<String, Object> map) {
                log.error("获取贵宾厅订单量失败:{}",cause.getMessage());
                return null;
            }

            @Override
            public int queryVipChannelNumber(Long customerId) {
                log.error("获取用户vip通道订单数量失败:{}",cause.getMessage());
                return 0;
            }

            @Override
            public int queryVipHallOrderNumber(Long customerId) {
                log.error("获取用户贵宾厅订单数量失败:{}",cause.getMessage());
                return 0;
            }

            @Override
            public JourneyOrderViphallVoApi journeyOrderViphallVo(Map<String, Object> map) {
                log.error("获取行程贵宾厅订单失败:{}",cause.getMessage());
                return null;
            }

            @Override
            public JourneyOrderViphallVoApi journeyOrderVipchannelVo(Map<String, Object> map) {
                log.error("获取行程vip通道订单失败:{}",cause.getMessage());
                return null;
            }

            @Override
            public JourneyOrderBoardingVoApi selectOrderBoardingDetailed(Map<String, Object> map) {
                log.error("获取行程值机订单失败:{}",cause.getMessage());
                return null;
            }

            @Override
            public int queryVipBoardingOrderNumber(Long customerId) {
                log.error("获取值机订单数量失败:{}",cause.getMessage());
                return 0;
            }

            @Override
            public List<OrderViphall> VipchannelOrederList(VipchannelOrederParameterVo vipchannelOrederParameterVo) {
                log.error("获取贵宾厅订单数量失败:{}",cause.getMessage());
                return null;
            }

            @Override
            public List<OrderVipchannel> VipchannelOrederListVo(VipchannelOrederParameterVo vipchannelOrederParameterVo) {
                log.error("获取vip通道订单数量失败:{}",cause.getMessage());
                return null;
            }

            @Override
            public List<OrderBoarding> orederList(VipchannelOrederParameterVo vipchannelOrederParameterVo) {
                log.error("获取值机订单数量失败:{}",cause.getMessage());
                return null;
            }

            @Override
            public OrderViphall orderNum(Map<String, Object> map) {
                log.error("获取贵宾厅订单失败",cause.getMessage());
                return null;
            }

            @Override
            public OrderVipchannel orderVipchannel(Map<String, Object> map) {
                return null;
            }

            @Override
            public OrderBoarding orderBoarding(Map<String, Object> map) {
                return null;
            }
        };
    }
}
